# Maintainer: David Runge <dvzrv@archlinux.org>

pkgname=zsh-history-substring-search
pkgver=1.0.2
pkgrel=2
pkgdesc="ZSH port of Fish history search (up arrow)"
arch=(any)
url="https://github.com/zsh-users/zsh-history-substring-search"
license=(BSD)
depends=(zsh)
source=($url/archive/v$pkgver/$pkgname-v$pkgver.tar.gz)
sha512sums=('9547cdd74f6bd5b102ca29b7b455cd4ce7450fe86864b5a149365de4c37d3da887edb403b195e80c142fe61861a3e4c063a5d8ba08ec0532b27a1207c80a023d')
b2sums=('26c6a080f82586eef9b33bfbe1da89951a6bb9d8e7362dca83d90b9d491e3cd497fb3b4be2ab1a94082351711b941bd7942cd554e7e4d93a69d4168ef13f80ee')

prepare() {
  # extract license info: https://github.com/zsh-users/zsh-history-substring-search/issues/148
  sed -e 's/^# //g; s/^#//g' -ne 4,38p $pkgname-$pkgver/$pkgname.zsh > LICENSE
}

package() {
  install -vDm 644 $pkgname-$pkgver/$pkgname.zsh -t "$pkgdir/usr/share/zsh/plugins/$pkgname/"
  install -vDm 644 $pkgname-$pkgver/README.md -t "$pkgdir/usr/share/doc/$pkgname/"
  install -vDm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
}
